<template>
  <el-container class="allpage">
    <el-header>
      <el-row class="position-fixed">
        <h1 style="margin-left: 10px;">搓澡项目信息表</h1>
        <!--        <el-button style="border: none;margin-top: 2px">-->
        <!--          <div style="height: 40px;width: 30px;">-->
        <!--            <img src="~@/assets/icons/imageicon/1.png" style="height: 28px;margin-top: 0px">-->
        <!--            <div style="margin-bottom: 10px">房间</div>-->
        <!--          </div>-->
        <!--        </el-button>-->

<!--        <el-button style="border: none;margin-top: 2px;margin-left: 2px" >
          <div style="height: 30px;width: 30px;">
            <img src="~@/assets/icons/imageicon/2.png" style="height: 28px;margin-top: 0px" @click="projectCateory(2)">
            <div style="margin-bottom: 10px">软饮</div>
          </div>
        </el-button>

        <el-button style="border: none;margin-top: 2px;margin-left: 2px">
          <div style="height: 40px;width: 30px;">
            <img src="~@/assets/icons/imageicon/8.png" style="height: 30px;margin-top: 0px" @click="projectCateory1(3)">
            <div style="margin-bottom: 10px">香烟</div>
          </div>
        </el-button>

        <el-button style="border: none;margin-top: 2px;margin-left: 2px">
          <div style="height: 40px;width: 30px;">
            <img src="~@/assets/icons/imageicon/4.png" style="height: 30px;margin-top: 0px">
            <div style="margin-bottom: 10px">酒水</div>
          </div>
        </el-button>

        <el-button style="border: none;margin-top: 2px;margin-left: 2px">
          <div style="height: 40px;width: 30px;">
            <img src="~@/assets/icons/imageicon/7.png" style="height: 28px;margin-top: 0px;margin-left: 6px">
            <div style="margin-bottom: 10px;margin-left: 6px">茶水</div>
          </div>
        </el-button>

        <el-button style="border: none;margin-top: 2px;margin-left: 2px">
          <div style="height: 30px;width: 30px;">
            <img src="~@/assets/icons/imageicon/11.png" style="height: 25px;margin-top: 0px">
            <div style="margin-bottom: 10px;margin-left: 2px">食品</div>
          </div>
        </el-button>-->

      </el-row>
    </el-header>

    <el-container>
      <el-aside>
        <div class="textout">
          <div class="text1">
            <el-row
              class="button-list1"

              v-for="rows in branchData"

            >
              <el-col v-for="cols in rows" :span="6">

                <el-button plain style="height: 80px;width: 125px;border: #1e1e1e;color: darkorange;margin-top: 5px"
                           type="success"
                           class="button1"
                           @click="handleAdddetail(cols.id)"
                >
                  <div>02021</div>
                  <div>{{cols.entryName}}</div>
                  <div>3.00</div>
                </el-button>
              </el-col>
            </el-row>
          </div>
        </div>
        <!--        &lt;!&ndash; 添加或修改项目信息对话框 &ndash;&gt;-->
        <!--        <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>-->
        <!--          <el-form ref="form" :data="List1" :rules="rules"  label-width="80px">-->
        <!--            <el-form-item label="项目名称" prop="entryName">-->
        <!--              <el-input :disabled="true"  placeholder="请输入项目名称" ></el-input>-->
        <!--            </el-form-item>-->
        <!--          </el-form>-->
        <!--        </el-dialog>-->
        <!--            <el-button type="primary" plain style="height: 80px;width: 125px;">-->
        <!--              <div>02022</div>-->
        <!--              <div>麦饭石鸡蛋4个</div>-->
        <!--              <div>10.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="success" plain style="height: 80px;width: 125px; color: green">-->
        <!--              <div>02028</div>-->
        <!--              <div>德氏奶葩</div>-->
        <!--              <div>5.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="info" plain style="height: 80px;width: 125px; color: dimgrey">-->
        <!--              <div>02064</div>-->
        <!--              <div>会员果盘赠</div>-->
        <!--              <div>0.00</div>-->
        <!--            </el-button>-->
        <!--          </el-row>-->

        <!--          <el-row class="button-list2" >-->
        <!--            <el-button type="warning" plain style="height: 80px;width: 125px; color: darkorange">-->
        <!--              <div>15045</div>-->
        <!--              <div>爆米花</div>-->
        <!--              <div>10.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button plain style="height: 80px;width: 125px;border: #1e1e1e;color: purple" class="button1">-->
        <!--              <div>15077</div>-->
        <!--              <div>德氏雪顶杯</div>-->
        <!--              <div>6.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="primary" plain style="height: 80px;width: 125px;">-->
        <!--              <div>15078</div>-->
        <!--              <div>德氏神马菠萝</div>-->
        <!--              <div>3.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="success" plain style="height: 80px;width: 125px; color: green">-->
        <!--              <div>15079</div>-->
        <!--              <div>德氏鸡蛋</div>-->
        <!--              <div>3.00</div>-->
        <!--            </el-button>-->
        <!--          </el-row>-->

        <!--          <el-row class="button-list2">-->
        <!--            <el-button type="info" plain style="height: 80px;width: 125px; color: dimgrey">-->
        <!--              <div>15080</div>-->
        <!--              <div>德氏鳄鱼</div>-->
        <!--              <div>4.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="warning" plain style="height: 80px;width: 125px; color: darkorange">-->
        <!--              <div>15081</div>-->
        <!--              <div>德氏小屋</div>-->
        <!--              <div>5.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button plain style="height: 80px;width: 125px;border: #1e1e1e;color: purple" class="button1">-->
        <!--              <div>15082</div>-->
        <!--              <div>小奶糕</div>-->
        <!--              <div>2.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="primary" plain style="height: 80px;width: 125px;">-->
        <!--              <div>20001</div>-->
        <!--              <div>榨菜</div>-->
        <!--              <div>3.00</div>-->
        <!--            </el-button>-->
        <!--          </el-row>-->

        <!--          <el-row class="button-list2">-->
        <!--            <el-button type="success" plain style="height: 80px;width: 125px; color: green">-->
        <!--            <div>20002</div>-->
        <!--            <div>八宝粥</div>-->
        <!--            <div>10.00</div>-->
        <!--          </el-button>-->
        <!--            <el-button type="info" plain style="height: 80px;width: 125px; color: dimgrey">-->
        <!--            <div>20003</div>-->
        <!--            <div>香肠</div>-->
        <!--            <div>5.00</div>-->
        <!--          </el-button>-->
        <!--            <el-button type="warning" plain style="height: 80px;width: 125px; color: darkorange">-->
        <!--              <div>20004</div>-->
        <!--              <div>碗面</div>-->
        <!--              <div>10.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button plain style="height: 80px;width: 125px;border: #1e1e1e;color: purple" class="button1">-->
        <!--              <div>20005</div>-->
        <!--              <div>中果盘</div>-->
        <!--              <div>69.00</div>-->
        <!--            </el-button>-->
        <!--          </el-row>-->

        <!--          <el-row class="button-list2">-->
        <!--            <el-button type="primary" plain style="height: 80px;width: 125px;">-->
        <!--              <div>20011</div>-->
        <!--              <div>大果盘</div>-->
        <!--              <div>99.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="success" plain style="height: 80px;width: 125px; color: green">-->
        <!--              <div>20019</div>-->
        <!--              <div>小果盘</div>-->
        <!--              <div>39.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="info" plain style="height: 80px;width: 125px; color: dimgrey">-->
        <!--              <div>02865</div>-->
        <!--              <div>会员果盘赠</div>-->
        <!--              <div>0.00</div>-->
        <!--            </el-button>-->
        <!--              <el-button type="warning" plain style="height: 80px;width: 125px; color: darkorange">-->
        <!--                <div>20004</div>-->
        <!--                <div>碗面</div>-->
        <!--                <div>10.00</div>-->
        <!--              </el-button>-->
        <!--          </el-row>-->

        <!--          <el-row class="button-list2" >-->
        <!--            <el-button plain style="height: 80px;width: 125px;border: #1e1e1e;color: purple" class="button1">-->
        <!--              <div>20005</div>-->
        <!--              <div>中果盘</div>-->
        <!--              <div>69.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="primary" plain style="height: 80px;width: 125px;">-->
        <!--              <div>20011</div>-->
        <!--              <div>大果盘</div>-->
        <!--              <div>99.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="success" plain style="height: 80px;width: 125px; color: green">-->
        <!--              <div>20019</div>-->
        <!--              <div>小果盘</div>-->
        <!--              <div>39.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="info" plain style="height: 80px;width: 125px; color: dimgrey">-->
        <!--              <div>02865</div>-->
        <!--              <div>会员果盘赠</div>-->
        <!--              <div>0.00</div>-->
        <!--            </el-button>-->
        <!--          </el-row>-->

        <!--          <el-row class="button-list2" >-->
        <!--            <el-button plain style="height: 80px;width: 125px;border: #1e1e1e;color: purple" class="button1">-->
        <!--              <div>20005</div>-->
        <!--              <div>中果盘</div>-->
        <!--              <div>69.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="primary" plain style="height: 80px;width: 125px;">-->
        <!--              <div>20011</div>-->
        <!--              <div>大果盘</div>-->
        <!--              <div>99.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="success" plain style="height: 80px;width: 125px; color: green">-->
        <!--              <div>20019</div>-->
        <!--              <div>小果盘</div>-->
        <!--              <div>39.00</div>-->
        <!--            </el-button>-->
        <!--            <el-button type="info" plain style="height: 80px;width: 125px; color: dimgrey">-->
        <!--              <div>02865</div>-->
        <!--              <div>会员果盘赠</div>-->
        <!--              <div>0.00</div>-->
        <!--            </el-button>-->
        <!--          </el-row>-->


        <!--        </div>-->
        <!--         软键盘-->
        <!--        <div class="text2">-->
        <!--          <div class="text4">-->
        <!--          <input-->
        <!--            :value="input"-->
        <!--            class="input"-->
        <!--            @input="onInputChange"-->
        <!--            placeholder="请输入商品名称"-->
        <!--          ></div>-->
        <!--          <div class="text3">-->
        <!--            <SimpleKeyboard @onChange="onChange" @onKeyPress="onKeyPress" :input="input"/>-->
        <!--          </div>-->

        <!--        </div>-->


      </el-aside>

      <el-container>
        <el-main>
          <el-form ref="form" :model="form" >
            <el-input
              v-model="hands.handBrand"
              size="small"
              label="手牌号"
              placeholder="请输入内容"
              @keyup.enter.native="gethandList"
              clearable>
            </el-input>
          </el-form>

          <el-table
            :data="tableData"
            height="360"
            border
            style="width: 1150px"
            class="listtable">
            <!--            <el-table-column-->
            <!--              prop="id"-->
            <!--              label="项目id"-->
            <!--              width="380">-->
            <!--            </el-table-column>-->
            <el-table-column
              prop="name"
              label="项目名称"
              width="200">
            </el-table-column>
            <el-table-column
              prop="number"
              label="数量"
              width="180">
            </el-table-column>
            <el-table-column
              prop="price"
              label="单价">
            </el-table-column>
            <el-table-column
              prop="sum_price"
              label="金额">
            </el-table-column>
            <el-table-column
              label="操作" width="100" align="center">
              <!--              删除按钮-->
              <el-button type="danger" icon="el-icon-delete" circle @click="DeleteProject()"></el-button>
            </el-table-column>

            <!--            <el-table-column-->
            <!--              prop="amount2"-->
            <!--              sortable-->
            <!--              label="技师">-->
            <!--            </el-table-column>-->
            <!--            <el-table-column-->
            <!--              prop="amount3"-->
            <!--              sortable-->
            <!--              label="做法">-->
            <!--            </el-table-column>-->
          </el-table>
          <el-card class="box-card" shadow="hover" >
<!--                        <el-button round @click="addFormm">确认提交订单</el-button>-->
            <div >
              <el-button style="float: left" class="add_btn1" type="primary" plain @click="addFormm"  size="medium">确认提交订单</el-button>
<!--              <el-button class="add_btn1" type="warning" plain @click="check">查询订单</el-button>-->
              <el-button style="float: right" class="add_btn1" type="danger" plain @click="tuichu">退出</el-button>


            </div>
          </el-card>


        </el-main>
      </el-container>
    </el-container>
  </el-container>


</template>

<script>
import { listDetails, getDetails, delDetails, addDetails, updateDetails } from "@/api/module/kfc/details";
import { listProject, getProject, delProject, addProject, updateProject } from "@/api/module/kfc/project";
import { listHands, getHands, delHands, addHands, updateHands } from "@/api/module/kfc/hands";
import { listBaseinfo, getBaseinfo, delBaseinfo, addBaseinfo, updateBaseinfo } from "@/api/module/kfc/baseinfo";
import SimpleKeyboard from "./SimpleKeyboard";
import "./App.css";

export default {
  name: "App",
  components: {
    SimpleKeyboard
  },
  data() {
    return {
      input: "",
      inputhand:"",
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 消费详细表格数据
      detailsList: [],
      // 商品数据
      projectList:[],
      branchData:[],
      goodsList:[],
      //人员信息表数据
      personList:[],
      //手牌表数据
      handsList:[],
      //展示已点
      List1: {
        entryName: null,
        quantity:null,
        handBrand: null,
        handCategory: null,
        handState: null,
        lockedState: null,
        //库中数据字段为1才是商品
        projectCategory:null,
        firstLevelClassification: null,
        secondaryClassification: null,
        tertiaryClassification: null,
        projectCode: null,
        mnemonicCode: null,
        unit: null,
        unitPrice: null,
        commissionPrice: null,
        clockUpTime: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询消费详细表参数
      consumptiondetail1: {
        pageNum: 1,
        pageSize: 100,
        userId: null,
        deptId: null,
        department: null,
        nickName: null,
        userName: null,
        post: null,
        handBrand: null,
        handCategory: null,
        handState: null,
        retentionStatus: null,
        mergeStatus: null,
        openingTime: null,
        drawTime: null,
        mergeHands: null,
        mergeBarBillsId: null,
        leaveTime: null,
        beforeLeave: null,
        beforeBarBillsId: null,
        entryName: null,
        projectCategory: null,
        projectCode: null,
        mnemonicCode: null,
        unit: null,
        unitPrice: null,
        commissionPrice: null,
        together: null,
        sailingsSigns: null,
        barBillsId: null,
        recordingTime: null,
        quantity: null,
        totalAmount: null,
        seat: null,
        orderNumber: null,
        paymentMethod: null,
        consumptionStatus: null,
        chargebackTime: null,
        reasonForChargeback: null,
        chargebackProcessorAccount: null,
        chargebackProcessorName: null,
        clockTime: null,
        nextClockTime: null,
        nextClockStatus: null,
        recordEmployeeNumber: null,
        recorderEmployeeName: null,
        roomType: null,
        openingHours: null,
        checkOutTime: null,
        checkOutStatus: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      // 表单参数
      form1: {},
      // 表单校验
      rules1: {
      },


      //查询项目信息表参数
      projectinformations:{
        pageNum: 1,
        pageSize: 10,
        entryName: null,
        //库中数据字段为1才是商品
        projectCategory:null,
        firstLevelClassification: null,
        secondaryClassification: null,
        tertiaryClassification: null,
        projectCode: null,
        mnemonicCode: null,
        unit: null,
        unitPrice: null,
        commissionPrice: null,
        clockUpTime: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      //查询项目信息表参数
      projectinformations2:{
        pageNum: 1,
        pageSize: 10,
        entryName: null,
        //库中数据字段为1才是商品
        projectCategory:null,
        firstLevelClassification: null,
        secondaryClassification: null,
        tertiaryClassification: null,
        projectCode: null,
        mnemonicCode: null,
        unit: null,
        unitPrice: null,
        commissionPrice: null,
        clockUpTime: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      //查询项目信息表参数
      projectinformations3:{
        pageNum: 1,
        pageSize: 10,
        entryName: null,
        //库中数据字段为1才是商品
        projectCategory:null,
        firstLevelClassification: null,
        secondaryClassification: null,
        tertiaryClassification: null,
        projectCode: null,
        mnemonicCode: null,
        unit: null,
        unitPrice: null,
        commissionPrice: null,
        clockUpTime: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },


      // 人员信息表查询参数
      personinfo: {
        pageNum: 1,
        pageSize: 10,
        userId: null,
        deptId: null,
        nickName: null,
        userName: null,
        idNumber: null,
        sex: null,
        phone: null,
        post: null,
        department: null,
        personnelStatus: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null
      },

      // 手牌表查询参数
      hands: {
        pageNum: 1,
        pageSize: 10,
        handBrand: null,
        handCategory: null,
        handState: null,
        lockedState: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getprojectList1();
  },
  mounted () {
    this.getRow();
  },
  methods: {

    addFormm:function(){
      this.$confirm('技师点单成功, 是否返回搓澡排号主页?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        center: true
      }).then(() => {
        // this.$message({
        //   type: 'success',
        //   message: '删除成功!'
        // });
        window.location.href="http://localhost/yuquangong/zhuye#/yuquangong/paihao";
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        });
      });
    },

    tuichu (){
      window.location.href="http://localhost/yuquangong/2#/yuquangong/paihao";
    },
    //根据字段不同数字进行分类
    projectCateory(cateory){
      this.projectinformations2.projectCategory=cateory;
      this.getprojectList2();
    },
    projectCateory1(category){
      this.projectinformations3.projectCateory=category;
      this.getprojectList3();
    },

    //页面自带的=========================================================================================================
    getSummaries(param) {
      const {columns, data} = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '总价';
          return;
        }
        const values = data.map(item => Number(item[column.property]));
        if (!values.every(value => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          sums[index] += ' 元';
        } else {
          sums[index] = 'N/A';
        }
      });

      return sums;
    },
    onChange(input) {
      this.input = input;
    },
    onKeyPress(button) {
      console.log("button", button);
    },
    onInputChange(input) {
      this.input = input.target.value;
    },
    //==================================================================================================================
    //查询=================================================================================================================
    /** 查询项目信息列表 */
    getprojectList1() {
      this.loading = true;
      listProject(this.projectinformations).then(response => {
        this.goodsList = response.rows;
        this.getRow();
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 查询项目信息列表 */
    getprojectList2() {
      this.loading = true;
      listProject(this.projectinformations2).then(response => {
        this.goodsList = response.rows
        this.getRow();
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 查询项目信息列表 */
    getprojectList3() {
      this.loading = true;
      listProject(this.projectinformations3).then(response => {
        this.goodsList = response.rows
        this.getRow();
        this.total = response.total;
        this.loading = false;
      });
    },

    /** 查询消费详细列表 */
    getdetailsList() {
      this.loading = true;
      listDetails(this.consumptiondetail).then(response => {
        this.detailsList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 查询人员基础信息列表 */
    getpersonList() {
      this.loading = true;
      listBaseinfo(this.personinfo).then(response => {
        this.personList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 查询手牌基础信息列表 */
    gethandList() {
      this.loading = true;
      listHands(this.hands.handBrand).then(response => {
        this.handsList = response.rows;

        this.total = response.total;
        this.loading = false;
      });
    },
    //查询========================================================================================================


    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    //重置消费详细表
    reset() {
      this.form = {
        ID: null,
        userId: null,
        deptId: null,
        department: null,
        nickName: null,
        userName: null,
        post: null,
        handBrand: null,
        handCategory: null,
        handState: null,
        retentionStatus: null,
        mergeStatus: null,
        openingTime: null,
        drawTime: null,
        mergeHands: null,
        mergeBarBillsId: null,
        leaveTime: null,
        beforeLeave: null,
        beforeBarBillsId: null,
        entryName: null,
        projectCategory: null,
        projectCode: null,
        mnemonicCode: null,
        unit: null,
        unitPrice: null,
        commissionPrice: null,
        together: null,
        sailingsSigns: null,
        barBillsId: null,
        recordingTime: null,
        quantity: null,
        totalAmount: null,
        seat: null,
        orderNumber: null,
        paymentMethod: null,
        consumptionStatus: null,
        chargebackTime: null,
        reasonForChargeback: null,
        chargebackProcessorAccount: null,
        chargebackProcessorName: null,
        clockTime: null,
        nextClockTime: null,
        nextClockStatus: null,
        recordEmployeeNumber: null,
        recorderEmployeeName: null,
        roomType: null,
        openingHours: null,
        checkOutTime: null,
        checkOutStatus: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },
    //重置项目信息表
    resetprojectinfo() {
      this.form = {
        ID: null,
        entryName: null,
        projectCategory: null,
        firstLevelClassification: null,
        secondaryClassification: null,
        tertiaryClassification: null,
        projectCode: null,
        mnemonicCode: null,
        unit: null,
        unitPrice: null,
        commissionPrice: null,
        clockUpTime: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },

    //搜索===============================================================================================================

    /**  搜索消费详细表按钮操作 */
    handleConsumption() {
      this.consumptiondetail.pageNum = 1;
      this.getdetailsList();
    },
    //搜索===============================================================================================================
    //新增===============================================================================================================
    /** 添加商品不进库操作 */
    handleAdddetail(id) {
      getProject(id).then(response => {
        this.List1 = response.data;
        this.List1.handBrand = this.hands.handBrand;
        //this.List1.handCategory = handsList[1].handCategory;
        // this.List1.handState = handsList[1].handState;
        // this.List1.lockedState = handsList[1].lockedState;
        // console.log(this.List1);
        if(this.detailsList.length===0){
          this.detailsList.push({
            entryName:this.List1.entryName,
            handBrand:this.List1.handBrand,
            projectCategory:this.List1.projectCategory,
            quantity:1,
          })
        }
        else{
          for (let i = 0; i < this.detailsList.length; i++) {
            if(this.detailsList[i].entryName === this.List1.entryName){
              this.detailsList[i].quantity= parseFloat(this.detailsList[i].quantity)+1
              break
              console.log(1);
              console.log(this.detailsList[i]);
            }else{
              if(i===this.detailsList.length-1){
                this.detailsList.push({
                  entryName:this.List1.entryName,
                  handBrand:this.List1.handBrand,
                  projectCategory:this.List1.projectCategory,
                  quantity:1,
                })
                i++
              }
            }
          }
        }

        // if(  List1.contains(detailsList.entryName)){
        //   this.detailsList.push({
        //     entryName:this.List1.entryName,
        //     handBrand:this.List1.handBrand,
        //     projectCategory:this.List1.projectCategory,
        //
        //   })
        //
        // }

        console.log(this.detailsList);
        console.log(this.detailsList[0]);
        console.log(this.List1);
      });


      // getProject(id).then(response => {
      //   this.form=response.data;
      //   console.log(this.form.entryName)
      // // this.open = true;
      // addDetails(this.form).then(response => {
      //   this.$modal.msgSuccess("新增成功");
      //   this.open = false;
      // });
      // });

    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    //新增===============================================================================================================
    //修改=================================================================================================================
    /** 修改消费详细表操作 */
    UpdatedetailsList(row) {
      this.reset();
      const ID = row.ID || this.ids
      getDetails(ID).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改消费详细";
      });
    },
    /** 修改项目信息表操作 */
    UpdateprojectList(row) {
      this.reset();
      const ID = row.ID || this.ids
      getProject(ID).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改项目信息";
      });
    },
    //将商品排放到左侧页面内
    getRow () {
      let arr = [];
      let row = Math.ceil(this.goodsList.length / 4);
      //  行循环
      for (let i = 0; i < row; i++) {
        //  第i行的商品
        arr[i] = [];
        // modLast：最后一行的商品个数
        let modLast = this.goodsList.length % 4 === 0 ? 4 : this.goodsList.length % 4;
        // lastRow：判断当前循环是不是最后一行，是就让内层循环最后一行的商品个数，不是则默认5个
        let lastRow = i === (row - 1) ? modLast : 4;
        //  列循环
        for (let j = 0; j < lastRow; j++) {
          arr[i][j] = this.goodsList[4 * i + j];
        }
      }

      //  最后得到arr数组，将数组赋值给一个变量
      this.branchData = arr;
      console.log(this.branchData);
    },
    //修改===============================================================================================================
    //新增===============================================================================================================
    /** 新增项目信息表*/
    addForm() {


  /*    this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.ID != null) {
            updateProject(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addProject(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });*/
    },
    /** 新增消费详细表*/
   /* addFormm() {
      console.log(this.detailsList);
      //批量插入
      for(var i=0;i<this.detailsList.length;i++){
        addDetails(this.detailsList[i]).then(response => {
        });}

      this.$modal.msgSuccess("新增成功");
      //重置已点商品表单
      this.detailsList=[];
      //重置手牌表单
      this.hands=[];

    }*/


  },
  //新增===============================================================================================================
  //删除===============================================================================================================

  // /** 添加商品不进库操作 */
  // handleAdddetail(id) {
  //   getProject(id).then(response => {
  //     this.List1 = response.data;
  //     console.log(this.List1);
  //     this.detailsList.push({
  //       entryName:this.List1.entryName
  //     })
  //   });/** 删除商品信息不进库操作 */
  DeleteProject() {

    this.List1.entryName=null;
    this.List1.id=null;
    this.List1.projectCategory=null;

    this.detailsList.push({
      entryName:this.List1.entryName})
    this.$modal.confirm('是否确认删除数据项？').then(function() {
      getProject(id).then(response => {
        this.List1 = response.data;

      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    })},
  // 删除消费详细表操作
  DelDetails(row){
    const IDs = row.ID || this.ids;
    this.$modal.confirm('是否确认删除消费详细编号为"' + IDs + '"的数据项？').then(function() {
      return delDetails(IDs);
    }).then(() => {
      this.getList();
      this.$modal.msgSuccess("删除成功");
    }).catch(() => {});
  },
  //删除===============================================================================================================




}
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.allpage{
  /*position: fixed;*/
  margin-left: 5px;
  margin-right: 10px;

}
.el-header{
  margin-left: 10px;
  margin-right: 10px;
  margin-bottom: 5px;
  background-color: #FFFFFF;
}

.el-aside {
  background-color: #E9EEF3;
  min-width:600px;
  margin-left: 10px;
  margin-right: 5px;
  margin-top: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
  position: inherit;
}

.el-main {
  background-color: #FFFFFF;
  color: #333;
  width: 1225px;
  margin-right: 5px;
  margin-top: 10px;
  margin-left: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
  position: inherit;
}
.el-aside,.el-main{
  height: 765px;
  margin-bottom: 10px;
}
.text1{
  height: 515px;
  border-radius: 4px;
  margin-bottom: 5px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);

}

.text2{
  height: 230px;
  width: 552px;
  border-radius: 4px;
  margin-bottom: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
  position: inherit;
}
.text3{
  height: 155px;
  margin-top: 5px;
  margin-left: 5px;
  margin-right: 5px;
  border-radius: 4px;
  position: inherit;

}
.iconstyle{
  margin-top: 5px;
}
.position-fixed{
  position: inherit;
  margin-bottom: 5px;
  margin-top: 10px;
}
.listtable{
  margin-top: 1px;
  overflow-y: auto;
  overflow-x: hidden;
  position: inherit;
}
.divide{
  margin-top: 4px;
  margin-bottom: 10px;
}
.button-list1{
  text-align: center;
}
.add_btn1 {
  min-width: 180px;
  min-height: 80px;
}


.button-list2{
  margin-top: 5px;
  text-align: center;
  margin-bottom: 5px;

}
.button1{
  background-color: #ebd4ef;
  border: #9c26b0;
}
::-webkit-scrollbar{
  width: 0!important;
}
::-webkit-scrollbar{
  width: 0!important;height: 0;
}


</style>

